package file;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;

/**
 * 获取file包中大小超过1000字节的所有子项
 * 输出这些子项的名字和实际占用的字节数
 */
public class Test03 {
    public static void main(String[] args) throws IOException {

        File dir = new File("java-study-se/src/file");
        if (dir.isDirectory()){
            File[] subs = dir.listFiles(new FileFilter() {
                @Override
                public boolean accept(File pathname) {
                    return pathname.length() >= 1000;
                }
            });
            for (int i = 0; i < subs.length; i++) {
                System.out.println(subs[i].getName()+": "+subs[i].length());
            }
        }

    }
}
